Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emit an $addFields stage before $sort with safe aliases if necessary #109

Conversation

hallettj
Copy link
Collaborator

This fixes sorting on field names that contain dollar signs or dots. It also provides a framework that we can use to sort on aggregation results.

Unlike $match (which has the $expr operator), the $sort stage does not have any way to express arbitrary expressions. That is necessary to use the $getField operator which is what we use to reference field names that need to be escaped. So what this PR does is to inject an $addFields stage before the $sort stage if necessary that creates aliases that are safe to use as keys in $sort.

@codedmart codedmart merged commit 6f264f3 into main Oct 1, 2024
1 check passed
@codedmart codedmart deleted the jessehallett/eng-989-use-columnref-instead-of-safe_name-in-make_sort branch October 1, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants